<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<div>试试混入现象会发生什么</div>
			<input type="text" />
			<input type="text" v-focus />
		</div>
		
		
	</body>
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	<script>
		var minxin = {
			data:function(){
				return{
					message:'hello',
					foo:'abc'
				}
			},
			created:function(){
				console.log('混入对象的钩子被调用了')
			}
		}
		
		var vm = new Vue({
			el:'#app',
			data:{
				message:'goodbye',
				bar:'def'
			},
			mixins:[minxin],
			created:function(){
				console.log('组件钩子被调用');
				console.log(this.$data)
			},
			directives:{ //局部自定义指令
				focus:{
					inserted:function(el){
						el.focus();
					}
				}
			}
		})
		
		//动态指令参数，对象字面量
		//全局自定义指令
		Vue.directive('focus',{
			inserted:function(el){
				el.focus();
			}
		})
		
		//vue推荐绝大多数情况下使用模板来创建html
		//level
		
		
	</script>
</html>

